<?php
/*
 * Created on Nov 4, 2007
 *
 * Continut:
 *
 */
	require_once('include/classes/process.class.php');
	require_once('include/classes/session.class.php');
	
	//$currentSession=new Session();
	//$currentProcess=new Process(& $currentSession, & $currentDatabase);
	// echo("1");
	$currentDatabase=new MySQLDB();
	//echo("1");
	$currentSession=new Session($currentDatabase);
	//echo("1");
	//echo $_SESSION['username'];
	//echo $_SESSION['userid'];
	$currentProcess=new Process($currentSession, $currentDatabase);

//echo("1");
//echo("***********");
if(isset($_GET['print'])){
	//echo "OK";
	$chapter=$_GET['chapter'];
	$docPath=$currentSession->docPath;
	//echo $chapter."-".$docPath;
	$loadChapter=new xmlChapter($chapter, rand(99,999999), $docPath);
	//echo "2";
	$loadChapter->printChapterToPdf();
}else{
	//$currentSession=new Session();
	//$currentProcess=new Process(& $currentSession, & $currentDatabase);
	// echo("1");
	$currentDatabase=new MySQLDB();
	//echo("1");
	$currentSession=new Session($currentDatabase);
	//echo("1");
	//echo $_SESSION['username'];
	//echo $_SESSION['userid'];
	$currentProcess=new Process($currentSession, $currentDatabase);
	if ($currentSession->logged_in){
		//echo("++++++");
		require_once('include/elements/header.inc.php');
		require_once('include/elements/topSection.inc.php');
		require_once('include/elements/leftSideSection.inc.php');
		require_once('include/elements/centerSection.php');
		require_once('include/elements/bottomSection.inc.php');
	}else {
		//echo("------");
		require_once('include/elements/guest_elements/g_header.inc.php');
		require_once('include/elements/guest_elements/g_topSection.inc.php');
		require_once('include/elements/guest_elements/g_leftSideSection.inc.php');
		require_once('include/elements/guest_elements/g_centerSection.php');
		require_once('include/elements/guest_elements/g_bottomSection.inc.php');
	}
}

?>
